-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[ASTMatchers] Simplify isDefaultedHelper (NFC) #137571
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ASTMatchers] Simplify isDefaultedHelper (NFC) #137571
Conversation
We can use "constexpt if" to combine the two variants of functions.
|
@llvm/pr-subscribers-clang Author: Kazu Hirata (kazutakahirata) ChangesWe can use "constexpt if" to combine the two variants of functions. Full diff: https://github.com/llvm/llvm-project/pull/137571.diff 1 Files Affected:
diff --git a/clang/include/clang/ASTMatchers/ASTMatchersInternal.h b/clang/include/clang/ASTMatchers/ASTMatchersInternal.h
index 8290645768aa9..00a4fefeac8f8 100644
--- a/clang/include/clang/ASTMatchers/ASTMatchersInternal.h
+++ b/clang/include/clang/ASTMatchers/ASTMatchersInternal.h
@@ -871,14 +871,11 @@ IteratorT matchesFirstInPointerRange(const MatcherT &Matcher, IteratorT Start,
return End;
}
-template <typename T, std::enable_if_t<!std::is_base_of<FunctionDecl, T>::value>
- * = nullptr>
-inline bool isDefaultedHelper(const T *) {
+template <typename T> inline bool isDefaultedHelper(const T *FD) {
+ if constexpr (std::is_base_of<FunctionDecl, T>::value)
+ return FD->isDefaulted();
return false;
}
-inline bool isDefaultedHelper(const FunctionDecl *FD) {
- return FD->isDefaulted();
-}
// Metafunction to determine if type T has a member called getDecl.
template <typename T>
|
Co-authored-by: Jakub Kuderski <[email protected]>
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/59/builds/16764 Here is the relevant piece of the build log for the reference |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/27/builds/9242 Here is the relevant piece of the build log for the reference |
We can use "constexpt if" to combine the two variants of functions. --------- Co-authored-by: Jakub Kuderski <[email protected]>
We can use "constexpt if" to combine the two variants of functions.